package com.itcast.yygh.hosp.controller;

import com.itcast.common.result.R;
import org.springframework.web.bind.annotation.*;

/**
 * 医院系统用户登录接口
 */

@RestController
@RequestMapping("/user")
//@CrossOrigin
public class UserController {

    //用户登录方法的实现
    @PostMapping("/login")
    public R login(){
        return R.ok().data("token","admin-token");
    }

    //用户登录后访问的信息
    @GetMapping("/info")
    public R info(){
        return R.ok().data("roles","[\"admin\"]").data("name","admin")
                .data("avatar","https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif");
    }
    //用户退出功能
    @PostMapping("/logout")
    public R logout(){
        return R.ok().message("退出成功!");
    }
}
